package com.ht.base.system.client;

import com.ht.base.system.common.pojo.bo.SysDictDataBO;
import com.ht.base.system.common.pojo.bo.SysDictTypeBO;
import com.ht.base.system.common.pojo.bo.SysUserBO;
import com.ht.base.system.common.pojo.qto.SysDictDataQTO;
import com.ht.base.system.common.pojo.qto.SysDictTypeQTO;
import org.base.common.appexception.AppException;
import org.base.common.appexception.ResultData;
import org.base.common.page.PageBO;

import java.util.List;

/**
 * @Author hdengxian
 * @Date 2023/8/15 17:12
 */
public interface SysDictClient {
    /**
     * 新增数据字典类型接口
     * @param user
     * @param dictTypeBO
     * @return
     * @throws AppException
     */
    ResultData<Boolean> saveDictType(SysUserBO user, SysDictTypeBO dictTypeBO) throws AppException;

    /**
     * 修改字典类型接口
     * @param user
     * @param dictTypeBO
     * @return
     * @throws AppException
     */
    ResultData<Boolean> updateDictType(SysUserBO user, SysDictTypeBO dictTypeBO) throws AppException;

    /**
     * 删除字典类型接口，同时会删除字典类型对应的数据
     * @param sysDictTypeId
     * @return
     * @throws AppException
     */
    ResultData<Boolean> deleteDictType(Long sysDictTypeId) throws AppException;

    /**
     * 通过字典类型ID查询字典类型。
     * 不会返回字典类型下的数据
     * @param sysDictTypeId
     * @return
     * @throws AppException
     */
    ResultData<SysDictTypeBO> findDictTypeById(Long sysDictTypeId) throws AppException;

    /**
     * 分页查询字典类型列表数据
     * @param qto
     * @return
     * @throws AppException
     */
    ResultData<PageBO<SysDictTypeBO>> findDictTypeForPage(SysDictTypeQTO qto) throws AppException;

//===============================================================================

    /**
     * 新增字典数据接口
     * @param user
     * @param dictDataBO
     * @return
     * @throws AppException
     */
    ResultData<Boolean> saveDictData(SysUserBO user, SysDictDataBO dictDataBO) throws AppException;

    /**
     * 修改字典数据接口
     * @param user
     * @param dictDataBO
     * @return
     * @throws AppException
     */
    ResultData<Boolean> updateDictData(SysUserBO user, SysDictDataBO dictDataBO) throws AppException;

    /**
     * 删除字典数据接口
     * @param dictType
     * @return
     * @throws AppException
     */
    ResultData<Boolean> deleteDictDataByType(String dictType) throws AppException;

    /**
     * 删除字典数据接口
     * @param sysDictDataId
     * @return
     * @throws AppException
     */
    ResultData<Boolean> deleteDictData(String sysDictDataId) throws AppException;

    /**
     * 通过字典数据ID查询字典数据
     * @param sysDictDataId
     * @return
     * @throws AppException
     */
    ResultData<SysDictDataBO> findDictDataById(String sysDictDataId) throws AppException;

    /**
     * 通过字典类型，查询该类型下的字典数据
     * 以List放回
     * @param dictType
     * @return
     * @throws AppException
     */
    ResultData<List<SysDictDataBO>> findDictDataListByType(String dictType) throws AppException;

    /**
     * 字典数据分页查询列表
     * @param qto
     * @return
     * @throws AppException
     */
    ResultData<PageBO<SysDictDataBO>> findDictDataForPage(SysDictDataQTO qto) throws AppException;
}
